using Senparc.Weixin.Entities;
using Senparc.Weixin.MP.CommonAPIs;
using System;
namespace Senparc.Weixin.MP.AdvancedAPIs.MerChant
{
	public static class ProductApi
	{
		public static AddProductResult AddProduct(string accessToken, AddProductData addProductData)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/create?access_token={0}";
			return CommonJsonSend.Send<AddProductResult>(accessToken, urlFormat, addProductData, CommonJsonSendType.POST, 10000, false);
		}
		public static WxJsonResult DeleteProduct(string accessToken, string productId)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/del?access_token={0}";
			var data = new
			{
				product_id = productId
			};
			return CommonJsonSend.Send<WxJsonResult>(accessToken, urlFormat, data, CommonJsonSendType.POST, 10000, false);
		}
		public static WxJsonResult UpDateProduct(string accessToken, UpdateProductData reviseProduct)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/update?access_token={0}";
			return CommonJsonSend.Send<WxJsonResult>(accessToken, urlFormat, reviseProduct, CommonJsonSendType.POST, 10000, false);
		}
		public static GetProductResult GetProduct(string accessToken, string productId)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/get?access_token={0}";
			var data = new
			{
				product_id = productId
			};
			return CommonJsonSend.Send<GetProductResult>(accessToken, urlFormat, data, CommonJsonSendType.POST, 10000, false);
		}
		public static GetByStatusResult GetByStatus(string accessToken, int status)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/getbystatus?access_token={0}";
			var data = new
			{
				status
			};
			return CommonJsonSend.Send<GetByStatusResult>(accessToken, urlFormat, data, CommonJsonSendType.POST, 10000, false);
		}
		public static WxJsonResult ModProductStatus(string accessToken, int status, string productId)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/modproductstatus?access_token={0}";
			var data = new
			{
				product_id = productId,
				status = status
			};
			return CommonJsonSend.Send<WxJsonResult>(accessToken, urlFormat, data, CommonJsonSendType.POST, 10000, false);
		}
		public static GetSubResult GetSub(string accessToken, long cateId)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/category/getsub?access_token={0}";
			var data = new
			{
				cate_id = cateId
			};
			return CommonJsonSend.Send<GetSubResult>(accessToken, urlFormat, data, CommonJsonSendType.POST, 10000, false);
		}
		public static GetSkuResult GetSku(string accessToken, long cateId)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/category/getsku?access_token={0}";
			var data = new
			{
				cate_id = cateId
			};
			return CommonJsonSend.Send<GetSkuResult>(accessToken, urlFormat, data, CommonJsonSendType.POST, 10000, false);
		}
		public static GetPropertyResult GetProperty(string accessToken, long cateId)
		{
			string urlFormat = "https://api.weixin.qq.com/merchant/category/getproperty?access_token={0}";
			var data = new
			{
				cate_id = cateId
			};
			return CommonJsonSend.Send<GetPropertyResult>(accessToken, urlFormat, data, CommonJsonSendType.POST, 10000, false);
		}
	}
}
